package com.gmcc.aiquality.webadmin.upms.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.util.StringUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.gmcc.aiquality.common.core.object.ResponseResult;
import com.gmcc.aiquality.common.log.annotation.OperationLog;
import com.gmcc.aiquality.common.log.model.constant.SysOperationLogType;
import com.gmcc.aiquality.webadmin.upms.model.Project;
import com.gmcc.aiquality.webadmin.upms.service.TaskProjectService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "project与data_collection_task的中间表")
@Slf4j
@RestController
@RequestMapping("/admin/upms/taskproject")
public class TaskProjectController {
    @Autowired
    private  TaskProjectService taskProjectService;
    @OperationLog(type = SysOperationLogType.ADD)
    @PostMapping("/add")
    public ResponseResult<Long> add(List<Project> projectList) {
        if(!CollUtil.isEmpty(projectList)){
            taskProjectService.add(projectList);
        }
        return ResponseResult.success(1L);
    }
}
